-
Notifications
You must be signed in to change notification settings - Fork 563
Added the mdbook-linkcheck backend #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Just before this gets merged we should probably blow away all the travis caches because travis now needs to use version 0.1.1 instead of 0.0.28 of |
|
I just added a commit which introduces a broken link and it looks the linkchecker correctly fails the build. Changes: diff --git a/src/about-this-guide.md b/src/about-this-guide.md
index ea84017..837bf95 100644
--- a/src/about-this-guide.md
+++ b/src/about-this-guide.md
@@ -11,4 +11,6 @@ be found at [the GitHub repository]. If you find any mistakes in the
guide, please file an issue about it -- or, even better, open a PR
with a correction!
+[A non-existent link](foo.md)
+
[the GitHub repository]: https://github.com/rust-lang-nursery/rustc-guide/Travis Log: Unless there's anything else you'd like to address, @nikomatsakis I think we're about ready to merge. |
99a3dd2 to
a501c72
Compare
nikomatsakis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left one nit.
| @@ -1,14 +1,11 @@ | |||
| language: rust | |||
| cache: | |||
| - pip | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, I meant to purge these at some point...
| To help prevent accidentally introducing broken links, we use the | ||
| `mdbook-linkcheck`. If installed on your machine `mdbook` will automatically | ||
| invoke this link checker, otherwise it will emit a warning saying it couldn't | ||
| be found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of links does this check? can it test https links too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reads the contents of the raw chapters then uses pulldown-cmark to find all the links on a page. Then if it's a link to another chapter we make sure that chapter exists, otherwise if its http(s) it'll try to GET the page using reqwests.
Fetching pages from the web is disabled by default because it can take a while when your book has lots of them. Therefore you need to set output.linkcheck.follow-web-links to true in your book.toml.
src/high-level-overview.md
Outdated
|
|
||
| The first thing you may wonder if | ||
|
|
||
| [query model]: https://github.com/rust-lang/rust/blob/master/src/librustc/ty/maps/README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, we should .. oh, maybe I didn't open that PR yet =)
I have a PR adding a chapter for this... I'll have to remember to patch this link. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the chapter: https://rust-lang-nursery.github.io/rustc-guide/query.html
src/ty.md
Outdated
| ``` | ||
|
|
||
| [the HIR]: ../hir/README.md | ||
| [the HIR]: https://github.com/rust-lang/rust/blob/master/src/librustc/hir/README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do have a HIR chapter, though... can we redirect to the HIR page instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... that link is showing up as a 404 for me. Has the PR for it landed yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, looks like it's hir.html, not hir-lowering.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah I renamed it =)
nikomatsakis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the links.
518a9c0 to
413c397
Compare
|
rebased. |
|
So how do I run the link checker? |
|
Perhaps you need Are you sure your book.toml is not in a weird state? EDIT: Lol, that's not what cargo update does 😛 |
Do I need some other version? |
|
I think you need >= 0.1 |
413c397 to
04cee3e
Compare
|
OK, got it. Weird that |
|
r=me once travis is happy =) |
Rustc dev guide sync
Now
mdbook0.1.0 has been released and themdbook-linkchecktool is on crates.io we can use it for automatic link checking.I also found two broken links from chapters which were copied form the original READMEs.
To use the
mdbook-linkchecktool you'll need to have it installed (cargo install mdbook-linkcheck). If it isn't installed,mdbookshould warn you saying a backend wasn't found, but continue on anyway.Because we're now using the linkchecker to validate every build, I've updated
travis.ymlto usemdbook buildas the test script. This also removes the need forci/github_pages.sh.We don't need to cache
pipor runpip install ghp_importsany more either because we're using the proper GitHub Pages deployment provider.Hopefully a smaller cache and not needing to install a Python program will speed up builds even more 🙂
(fixes #20)